package utils

import "github.com/gin-gonic/gin"

func response(ctx *gin.Context, code int, msg string, data interface{}) {
	ctx.JSON(200, gin.H{
		"code": code,
		"data": data,
		"msg":  msg,
	})
}

func SuccessResponse(ctx *gin.Context, msg string, data interface{}) {
	response(ctx, 0, msg, data)
	ctx.Abort()
}
func FailResponse(ctx *gin.Context, msg string, data interface{}) {
	response(ctx, 1, msg, data)
	ctx.Abort()
}
